package com.sample.springbootsample.random;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.sample.springbootsample.model.APIResponse;
import com.sample.springbootsample.model.Data;

import java.lang.reflect.Type;

/**
 * @projectName: spring-boot-sample
 * @description:
 * @author: Adam
 * @create: 2019-12-09 22:17
 **/

public class JsonObject {

    public static void main(String[] args){
        new JsonObject().jsonObject();
    }


    public void jsonObject(){
        String jsonStr = "{\n" +
                "    \"data\": {\n" +
                "        \"data\": {\n" +
                "            \"obj2assessBases\": {\n" +
                "                \"64f49assfa484a3eaa4cfe7f37d9074b\": [\n" +
                "                    {\n" +
                "                        \"firstAssessDetail\": {\n" +
                "                            \"assessBase\": {\n" +
                "                                \"contactCode\": \"c92d5dd9f6794bd499abbee425b82d07\", \n" +
                "                                \"accountName\": \"393756150924837144\", \n" +
                "                                \"assessObjId\": \"8\", \n" +
                "                                \"updateAt\": 1575889735000, \n" +
                "                                \"content\": \"\", \n" +
                "                                \"createAt\": 1575889735000, \n" +
                "                                \"utmId\": \"QD0001\", \n" +
                "                                \"deleteFlag\": false, \n" +
                "                                \"updateBy\": \"393756150924837144\", \n" +
                "                                \"bizId\": \"\", \n" +
                "                                \"id\": \"3846380433203576930\", \n" +
                "                                \"firstFlag\": true, \n" +
                "                                \"customPropertyJson\": \"\", \n" +
                "                                \"bizDesc\": \"物流\", \n" +
                "                                \"contactId\": \"1\", \n" +
                "                                \"contactName\": \"精选商城订单评价\", \n" +
                "                                \"relaCode\": \"lynkco_boutique_mall\", \n" +
                "                                \"parentId\": \"-1\", \n" +
                "                                \"typeCode\": \"5\", \n" +
                "                                \"accountId\": \"393756150924837144\", \n" +
                "                                \"createBy\": \"393756150924837144\", \n" +
                "                                \"selectionFlag\": false, \n" +
                "                                \"tenantId\": \"569001643002\", \n" +
                "                                \"objId\": \"8\", \n" +
                "                                \"bizNumber\": \"U19343110000044583\", \n" +
                "                                \"status\": 0\n" +
                "                            }, \n" +
                "                            \"assessDimensionScoreDtos\": [\n" +
                "                                {\n" +
                "                                    \"score\": 100, \n" +
                "                                    \"createBy\": \"393756150924837144\", \n" +
                "                                    \"dimensionId\": \"1000000000000011537\", \n" +
                "                                    \"updateBy\": \"393756150924837144\", \n" +
                "                                    \"name\": \"物流服务评分\", \n" +
                "                                    \"dimensionCode\": \"62c936bcb1bc4fe0992dbe2133c416ed\", \n" +
                "                                    \"updateAt\": 1575889735000, \n" +
                "                                    \"id\": \"3846380433203576931\", \n" +
                "                                    \"assessId\": \"3846380433203576930\", \n" +
                "                                    \"createAt\": 1575889735000\n" +
                "                                }\n" +
                "                            ]\n" +
                "                        }\n" +
                "                    }\n" +
                "                ], \n" +
                "                \"64f49a44fa484a3eaa4cfe7f37d9074b\": [\n" +
                "                    {\n" +
                "                        \"firstAssessDetail\": {\n" +
                "                            \"assessBase\": {\n" +
                "                                \"contactCode\": \"c92d5dd9f6794bd499abbee425b82d07\", \n" +
                "                                \"accountName\": \"393756150924837144\", \n" +
                "                                \"assessObjId\": \"3\", \n" +
                "                                \"updateAt\": 1575889735000, \n" +
                "                                \"content\": \"\", \n" +
                "                                \"createAt\": 1575889735000, \n" +
                "                                \"utmId\": \"QD0001\", \n" +
                "                                \"deleteFlag\": false, \n" +
                "                                \"updateBy\": \"393756150924837144\", \n" +
                "                                \"bizId\": \"\", \n" +
                "                                \"id\": \"3846380433203576926\", \n" +
                "                                \"firstFlag\": true, \n" +
                "                                \"customPropertyJson\": \"\", \n" +
                "                                \"bizDesc\": \"商城\", \n" +
                "                                \"contactId\": \"1\", \n" +
                "                                \"contactName\": \"精选商城订单评价\", \n" +
                "                                \"relaCode\": \"lynkco_boutique_mall\", \n" +
                "                                \"parentId\": \"-1\", \n" +
                "                                \"typeCode\": \"4\", \n" +
                "                                \"accountId\": \"393756150924837144\", \n" +
                "                                \"createBy\": \"393756150924837144\", \n" +
                "                                \"selectionFlag\": false, \n" +
                "                                \"tenantId\": \"569001643002\", \n" +
                "                                \"objId\": \"3\", \n" +
                "                                \"bizNumber\": \"U19343110000044583\", \n" +
                "                                \"status\": 0\n" +
                "                            }, \n" +
                "                            \"assessDimensionScoreDtos\": [\n" +
                "                                {\n" +
                "                                    \"score\": 100, \n" +
                "                                    \"createBy\": \"393756150924837144\", \n" +
                "                                    \"dimensionId\": \"1000000000000011536\", \n" +
                "                                    \"updateBy\": \"393756150924837144\", \n" +
                "                                    \"name\": \"商城服务评分\", \n" +
                "                                    \"dimensionCode\": \"bdf44ca8ed1e46b294c311c8440778ed\", \n" +
                "                                    \"updateAt\": 1575889735000, \n" +
                "                                    \"id\": \"3846380433203576927\", \n" +
                "                                    \"assessId\": \"3846380433203576926\", \n" +
                "                                    \"createAt\": 1575889735000\n" +
                "                                }\n" +
                "                            ]\n" +
                "                        }\n" +
                "                    }\n" +
                "                ], \n" +
                "                \"20f4c0aefff841e380080edf7e99abf6\": [\n" +
                "                    {\n" +
                "                        \"firstAssessDetail\": {\n" +
                "                            \"assessBase\": {\n" +
                "                                \"contactCode\": \"c92d5dd9f6794bd499abbee425b82d07\", \n" +
                "                                \"accountName\": \"393756150924837144\", \n" +
                "                                \"assessObjId\": \"4\", \n" +
                "                                \"updateAt\": 1575889735000, \n" +
                "                                \"content\": \"暂无评价内容！\", \n" +
                "                                \"createAt\": 1575889735000, \n" +
                "                                \"utmId\": \"QD0001\", \n" +
                "                                \"deleteFlag\": false, \n" +
                "                                \"updateBy\": \"393756150924837144\", \n" +
                "                                \"bizId\": \"11620\", \n" +
                "                                \"id\": \"3846380433203576928\", \n" +
                "                                \"firstFlag\": true, \n" +
                "                                \"customPropertyJson\": \"颜色:橙色\", \n" +
                "                                \"bizDesc\": \"03TCR赛车帽\", \n" +
                "                                \"contactId\": \"1\", \n" +
                "                                \"contactName\": \"精选商城订单评价\", \n" +
                "                                \"relaCode\": \"lynkco_boutique_mall\", \n" +
                "                                \"parentId\": \"-1\", \n" +
                "                                \"typeCode\": \"0\", \n" +
                "                                \"accountId\": \"393756150924837144\", \n" +
                "                                \"createBy\": \"393756150924837144\", \n" +
                "                                \"selectionFlag\": false, \n" +
                "                                \"tenantId\": \"569001643002\", \n" +
                "                                \"objId\": \"4df41eb93f6354c5\", \n" +
                "                                \"bizNumber\": \"U19343110000044583\", \n" +
                "                                \"status\": 0\n" +
                "                            }, \n" +
                "                            \"assessDimensionScoreDtos\": [\n" +
                "                                {\n" +
                "                                    \"score\": 100, \n" +
                "                                    \"createBy\": \"393756150924837144\", \n" +
                "                                    \"dimensionId\": \"1000000000000011534\", \n" +
                "                                    \"updateBy\": \"393756150924837144\", \n" +
                "                                    \"name\": \"产品评分\", \n" +
                "                                    \"dimensionCode\": \"0e72c429261e4d21a219a17a9cbe5282\", \n" +
                "                                    \"updateAt\": 1575889735000, \n" +
                "                                    \"id\": \"3846380433203576929\", \n" +
                "                                    \"assessId\": \"3846380433203576928\", \n" +
                "                                    \"createAt\": 1575889735000\n" +
                "                                }\n" +
                "                            ]\n" +
                "                        }\n" +
                "                    }\n" +
                "                ]\n" +
                "            }, \n" +
                "            \"updateAt\": 1575889735000, \n" +
                "            \"createAt\": 1575889735000, \n" +
                "            \"bizNumber\": \"U19343110000044583\"\n" +
                "        }, \n" +
                "        \"error\": \"maskit.success.general\", \n" +
                "        \"message\": \"Maskit general success\", \n" +
                "        \"status\": \"200\", \n" +
                "        \"timestamp\": \"1575889748514\"\n" +
                "    }, \n" +
                "    \"status\": {\n" +
                "        \"code\": \"200\", \n" +
                "        \"msg\": \"SUCCESS\"\n" +
                "    }\n" +
                "}";

        JSONObject jsonObject_0 = JSONObject.parseObject(jsonStr);
        JSONObject jsonObject_1 = JSONObject.parseObject(JSON.toJSONString(jsonObject_0.get("data")));
        JSONObject jsonObject_2 = JSONObject.parseObject(JSONObject.toJSONString(jsonObject_1.get("data")));

        JSONObject object =  JSONObject.parseObject(JSON.toJSONString(jsonObject_2));
        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(object.get("obj2assessBases")));
        JSONArray jsonArray = (JSONArray) jsonObject.get("64f49a44fa484a3eaa4cfe7f37d9074b");
        JSONObject jsonObject0 = JSONObject.parseObject(JSON.toJSONString(jsonArray.get(0)));
        JSONObject jsonObject1 = JSONObject.parseObject(JSON.toJSONString(jsonObject0.get("firstAssessDetail")));
        JSONObject jsonObject2 = JSONObject.parseObject(JSON.toJSONString(jsonObject1.get("assessBase")));
        String firstReviewId = jsonObject2.get("id").toString();
        //APIResponse<Data<Object>> data =
        System.out.println(JSON.toJSONString(firstReviewId));
    }
}
